package com.jw.qme.controller;

import com.jw.qme.domain.dto.HeartbeatRequestDTO;
import com.jw.qme.domain.vo.HeartbeatVO;
import com.jw.qme.service.impl.HeartbeatService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/api/heartbeat")
public class HeartbeatController {

    private final HeartbeatService heartbeatService;

    @Autowired
    public HeartbeatController(HeartbeatService heartbeatService) {
        this.heartbeatService = heartbeatService;
    }

    @PostMapping
    public HeartbeatVO heartbeat(@RequestBody HeartbeatRequestDTO request) {
        return heartbeatService.handleHeartbeat(request);
    }
}
